package com.itheima.treeset;

import java.util.TreeSet;

public class MyTreeSetDemo1 {
    public static void main(String[] args) {
        TreeSet<String> treeSet=new TreeSet<>(
                (o1,o2)->{
            int result=o1.length()-o2.length();
            return result==0?o1.compareTo(o2):result;
        });
        treeSet.add("abc");
        treeSet.add("bcdf");
        treeSet.add("abcd");
        treeSet.add("gf");
        System.out.println(treeSet);
    }
}
